import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JButton;
/**
 * 
 * @author Justin Ryan Hurst
 * @version v 0.5
 * This is simply a test version for David to use. 
 * Although the interface is the same the visual 
 * representations will be significantly different
 * in the final version. This just makes it 
 * really easy for David to test his board class 
 * as he is building it. 
 */
enum SpaceFace {
	SHIP, FIRE, SPLASH, WATER; 
}  

public class Space extends JButton {
	/**
	 * By Default each space will appear
	 */
	public Space(){
		super("");
		
		Font cFont = this.getFont();
		this.setFont(new Font(cFont.getName(), cFont.getStyle(), 8));
		this.setPreferredSize(new Dimension(DEFAULT_SIZE, DEFAULT_SIZE));
		this.setBackground(new Color(0,0,255));
		this.setForeground(new Color(255, 255, 255));
		face = SpaceFace.WATER;
	}
	/**
	 * @param e : is the current Face would like to set it at
	 *  SpaceFace.SHIP = Display a ship part on the board
	 *  SpaceFace.FIRE = Display that there is a ship that has been hit on this board
	 *  SpaceFace.SPLASH = Display that the player missed a ship
	 *  SpaceFace.WATER = Either there is nothing here or the player does not know what is here
	 */
	public void setFace(SpaceFace e){
		face = e;
		if(e == SpaceFace.FIRE){
			this.setText("X");
			this.setBackground(new Color(255, 0, 0));
		} else if(e == SpaceFace.WATER) {
			this.setText("");
			this.setBackground(new Color(0,0,255));
		} else if(e == SpaceFace.SPLASH){
			this.setText("S");;
			this.setBackground(new Color(25, 175, 215));
		} else if(e == SpaceFace.SHIP){
			this.setText("O");
			this.setBackground(new Color(75, 75, 75));
			
		}
	}
	/**
	 * @return Returns which state the face is currently;
	 */
	public SpaceFace getFace(){
		return face;
	}
	private SpaceFace face;
	
	public static int DEFAULT_SIZE = 32;
}
